package com.hema.auction.bean;

import android.os.Parcel;
import android.os.Parcelable;

import com.bumptech.glide.util.Util;
import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;
import com.google.gson.annotations.Until;
import com.hema.auction.utils.Utils;

import java.util.Arrays;
import java.util.List;

/**
 * 描述:晒单广场实体
 * 作者:john
 */
public class SunSquareInfo implements Parcelable {

    /**
     * user_name : 不开机梵蒂冈不离开
     * face_pic : null
     * addtime : 1500542701
     * good_name : sun
     * contents : 测试下这个晒单
     * img : www.111.com,www.222.com
     */

    @SerializedName("user_name")
    private String userName;
    @SerializedName("face_pic")
    private String facePic;
    @SerializedName("addtime")
    private String addtime;
    @SerializedName("good_name")
    private String goodName;
    @SerializedName("contents")
    private String contents;
    @SerializedName("img")
    private String img;
    private List<String> imgs;

    public List<String> getImgs() {
        if (Utils.isEmpty(img))
            return null;
        String[] imgsStr = img.split(",");
        return Arrays.asList(imgsStr);
    }

    public void setImgs(List<String> imgs) {
        this.imgs = imgs;
    }

    public static SunSquareInfo objectFromData(String str) {

        return new Gson().fromJson(str, SunSquareInfo.class);
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getFacePic() {
        return facePic;
    }

    public void setFacePic(String facePic) {
        this.facePic = facePic;
    }

    public String getAddtime() {
        return addtime;
    }

    public void setAddtime(String addtime) {
        this.addtime = addtime;
    }

    public String getGoodName() {
        return goodName;
    }

    public void setGoodName(String goodName) {
        this.goodName = goodName;
    }

    public String getContents() {
        return contents;
    }

    public void setContents(String contents) {
        this.contents = contents;
    }

    public String getImg() {
        return img;
    }

    public void setImg(String img) {
        this.img = img;
    }

    public SunSquareInfo() {
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.userName);
        dest.writeString(this.facePic);
        dest.writeString(this.addtime);
        dest.writeString(this.goodName);
        dest.writeString(this.contents);
        dest.writeString(this.img);
        dest.writeStringList(this.imgs);
    }

    protected SunSquareInfo(Parcel in) {
        this.userName = in.readString();
        this.facePic = in.readString();
        this.addtime = in.readString();
        this.goodName = in.readString();
        this.contents = in.readString();
        this.img = in.readString();
        this.imgs = in.createStringArrayList();
    }

    public static final Creator<SunSquareInfo> CREATOR = new Creator<SunSquareInfo>() {
        @Override
        public SunSquareInfo createFromParcel(Parcel source) {
            return new SunSquareInfo(source);
        }

        @Override
        public SunSquareInfo[] newArray(int size) {
            return new SunSquareInfo[size];
        }
    };
}

